﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using AutoMapper;
using ModelLayer;
using modAdmin = ShopKart.Areas.Admin.Models;
using modUser = ShopKart.Areas.User.Models;

namespace ShopKart.App_Start
{
    public class MapperConfig
    {
        public static void RegisterMaps()
        {
            #region Admin Model Mapping

            Mapper.CreateMap<Category, modAdmin.CategoryVm>()
                .ForMember(d => d.Categories, o => o.Ignore())
                .ReverseMap();

            Mapper.CreateMap<Product, modAdmin.ProductVm>()
                .ForMember(d => d.Categories, o => o.Ignore())
                .ForMember(d => d.Products, o => o.Ignore())
                .ReverseMap();

            #endregion


            #region User Model Mapping

            Mapper.CreateMap<User, modUser.UserVm>()
                .ReverseMap();

            Mapper.CreateMap<Product, modUser.ProductVm>()
               .ForMember(d => d.Products, o => o.Ignore())
               .ReverseMap();
            #endregion

        }
    }
}